<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create new xmlwriter using source uri for output</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="xmlwriter.openmemory.html">« XMLWriter::openMemory</a></li>
      <li style="float: right;"><a href="xmlwriter.outputmemory.html">XMLWriter::outputMemory »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.xmlwriter.html">XMLWriter</a></li>
    <li>Create new xmlwriter using source uri for output</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="xmlwriter.openuri" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">XMLWriter::openUri</h1>
  <h1 class="refname">xmlwriter_open_uri</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8, PECL xmlwriter &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">XMLWriter::openUri</span> -- <span class="refname">xmlwriter_open_uri</span> &mdash; <span class="dc-title">Create new xmlwriter using source uri for output</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-xmlwriter.openuri-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>XMLWriter::openUri</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$uri</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">过程化风格</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>xmlwriter_open_uri</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$uri</code></span>): <span class="type"><span class="type"><a href="class.xmlwriter.html" class="type XMLWriter">XMLWriter</a></span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   Creates a new <span class="classname"><a href="class.xmlwriter.html" class="classname">XMLWriter</a></span> using 
   <code class="parameter">uri</code> for the output.  
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-xmlwriter.openuri-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">uri</code></dt>

     <dd>

      <p class="para">
       The URI of the resource for the output.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-xmlwriter.openuri-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   面向对象风格: 成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
  <p class="para">
   过程化风格: Returns a new <span class="classname"><a href="class.xmlwriter.html" class="classname">XMLWriter</a></span> instance for later use with the
   xmlwriter functions on success,  或者在失败时返回 <strong><code>false</code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-xmlwriter.openuri-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       This function returns now an <span class="classname"><a href="class.xmlwriter.html" class="classname">XMLWriter</a></span> instance on success.
       Previouly, a <a href="language.types.resource.html" class="link">资源(resource)</a> has been returned in this case.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-xmlwriter.openuri-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="xmlwriter-open-uri.example.basic">
   <p><strong>示例 #1 Direct output of XML</strong></p>
   <div class="example-contents"><p>
     It is possible to directly output XML by using the
     <a href="wrappers.php.html#wrappers.php.output" class="link">php://output stream wrapper</a>.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$out&nbsp;</span><span style="color: #007700">=new&nbsp;</span><span style="color: #0000BB">XMLWriter</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$out</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">openURI</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 notes" id="refsect1-xmlwriter.openuri-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    On Windows, files opened with this function are locked until the writer is
    released.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-xmlwriter.openuri-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="xmlwriter.openmemory.html" class="methodname" rel="rdfs-seeAlso">XMLWriter::openMemory()</a> - Create new xmlwriter using memory for string output</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>